<template>
  <div class="grid-number" :class="[...className]">
    <div>{{ title }} 
      <el-tooltip v-if="tips && tips.length" class="item" effect="dark" :content="tips" placement="top-start">
        <i class="el-icon-warning-outline"></i>
        <!-- <el-button>
          <i class="el-icon-warning-outline"></i>
        </el-button> -->
      </el-tooltip>
     </div>
    <div class="grid-number-content">
      <strong>{{ number }}</strong>
      {{ suffix }}
    </div>
    <div v-if="!disabled" class="pop">
      <slot></slot>
    </div>
    <div v-if="hover" class="hover">
      <slot name="hover"></slot>
    </div>
    
  </div>
</template>

<script>
export default {
  props: {
    title: String,
    number: {
      type: [String, Number],
    },
    suffix: String,
    disabled: {
      type: Boolean,
      default: true,
    },
    hover: {
      type: Boolean,
      default: false,
    },
    tips: {
      type: String,
      default: ''
    },
    className: Array,
  },
  data(){
    return {
      showTips: false
    }
  }
};
</script>

<style lang="scss">
.grid-number {
  padding: 12px 20px;
  border-radius: 4px;
  background: #fff;
  border: 1px solid #e4e4e4;
  font-size: 14px;
  color: #838588;
  width: 30%;
  margin: 5px 0;
  min-width: 260px;
  box-sizing: border-box;
  position: relative;
  &.red {
    background: url(~@/assets/svg/bg-red.svg) no-repeat center right/cover;
  }
  &.blue {
    background: url(~@/assets/svg/bg-blue.svg) no-repeat center right/cover;
  }
  &.orange {
    background: linear-gradient(135deg, #e5cf81, #c6a14a);
  }
  &.red,
  &.blue,
  &.orange {
    color: rgba(255, 255, 255, 0.75);
    strong {
      color: #fff;
    }
  }
  &.outline {
    background: #fff;
    border: 1px solid #f2f6fa;
  }

  strong {
    font-size: 32px;
    color: #333;
    margin-right: 2px;
    font-family: DINPro, DINPro-Bold;
  }
  .small {
    font-size: 12px;
  }
  .grid-number-content {
    margin-top: 8px;
  }
  .pop {
    height: 100%;
    position: absolute;
    top: 0;
    z-index: 50;
    right: 0;
  }
  .hover {
    width: 100%;
    min-height: 100px;
    position: absolute;
    top: 110%;
    z-index: -1;
    left: 0;
    border: 1px solid #e4e4e4;
    opacity: 0;
  }
  &:hover {
    .hover {
      opacity: 1;
      z-index: 50;
    }
  }
}
</style>